Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cdk): Add AppSync:Api_Key as hot swappable and fix a bug with AppSync.function #27559

Merged
merged 5 commits into from
Oct 24, 2023

Conversation

Amplifiyer
Copy link
Contributor

Add AppSync:Api_Key as hots wappable and fix the bug where AppSync.function doesn't allow setting version and runtime

  1. Allow expires property of resource AWS::AppSync::Api_Key to be hot-swappable
  2. Read the Api_Key_id from the physical ARN if not available from resource properties. (It's optional in CFN but mandatory in SDK)
  3. UpdateFunction doesn't allow setting both functionVersion and runtime in the SDK (allowed in CFN). Update to remove one based on if code is provided or mappingTemplates
  4. Fix a bug where the file returned from S3 was not being decoded from buffer.
  5. Increase the timeout and number of retries for concurrent modification of AppSync.Functions.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions github-actions bot added the repeat-contributor [Pilot] contributed between 3-5 PRs to the CDK label Oct 16, 2023
@aws-cdk-automation aws-cdk-automation requested a review from a team October 16, 2023 14:15
@github-actions github-actions bot added the p2 label Oct 16, 2023
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@aws-cdk-automation aws-cdk-automation added the pr/needs-cli-test-run This PR needs CLI tests run against it. label Oct 16, 2023
@comcalvi comcalvi self-assigned this Oct 17, 2023
Copy link
Contributor

@comcalvi comcalvi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only minor comments, looks great!

Comment on lines +121 to +124
const arnParts = physicalName?.split('/');
if (arnParts && arnParts.length === 4) {
sdkRequestObject.id = arnParts[3];
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Arn.html here and do Arn.split instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems the Arn.split only considers one resourceType or resourceName but not "nested" resource such as in this case arn:aws:appsync:us-east-1:111111111111:apis/apiId/apikeys/api-key-id
Arn.split returns the entire apiId/apikeys/api-key-id as the resourceName which then requires a split anyways.

{
    service: 'appsync',
    resource: 'apis',
    partition: 'aws',
    region: 'us-east-1',
    account: '111111111111',
    resourceName: 'apiId/apikeys/api-key-id',
    sep: '/',
    arnFormat: 'arn:aws:service:region:account:resource/resourceName'
}

Moreover, Arn.split is in aws-cdk-lib and the change will require we bump the dependency from dev to runtime which might cause cyclic dependency issue? Let me know what you think

Co-authored-by: Calvin Combs <66279577+comcalvi@users.noreply.github.com>
@Amplifiyer Amplifiyer marked this pull request as ready for review October 18, 2023 19:17
@comcalvi comcalvi added pr-linter/cli-integ-tested Assert that any CLI changes have been integ tested and removed pr/needs-cli-test-run This PR needs CLI tests run against it. labels Oct 21, 2023
comcalvi
comcalvi previously approved these changes Oct 21, 2023
@comcalvi comcalvi added the pr-linter/exempt-integ-test The PR linter will not require integ test changes label Oct 21, 2023
@aws-cdk-automation aws-cdk-automation dismissed their stale review October 21, 2023 05:16

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@mergify
Copy link
Contributor

mergify bot commented Oct 21, 2023

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot dismissed comcalvi’s stale review October 24, 2023 13:22

Pull request has been modified.

@mergify
Copy link
Contributor

mergify bot commented Oct 24, 2023

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: c64e101
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit 12ff023 into aws:main Oct 24, 2023
8 of 9 checks passed
@mergify
Copy link
Contributor

mergify bot commented Oct 24, 2023

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

mrgrain pushed a commit that referenced this pull request Nov 1, 2023
…Sync.function (#27559)

Add AppSync:Api_Key as hots wappable and fix the bug where AppSync.function doesn't allow setting version and runtime

1. Allow `expires` property of resource `AWS::AppSync::Api_Key` to be hot-swappable
2. Read the Api_Key_id from the physical ARN if not available from resource properties. (It's optional in CFN but mandatory in SDK)
3. UpdateFunction doesn't [allow](https://docs.aws.amazon.com/appsync/latest/APIReference/API_UpdateFunction.html) setting both `functionVersion` and `runtime` in the SDK (allowed in CFN). Update to remove one based on if `code` is provided or `mappingTemplates`
4. Fix a bug where the file returned from S3 was not being decoded from buffer.
5. Increase the timeout and number of retries for concurrent modification of AppSync.Functions.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p2 pr-linter/cli-integ-tested Assert that any CLI changes have been integ tested pr-linter/exempt-integ-test The PR linter will not require integ test changes repeat-contributor [Pilot] contributed between 3-5 PRs to the CDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants